var app = getApp();
Component({
  properties: {
    list: {
      type: Array,
      value: []
    }
  },
  data: {
    imgHost: app.globalData.imgPath,
    now:0,
    language: "",
    timeData:""
  }, // 私有数据，可用于模板渲染

  lifetimes: {
    // 生命周期函数，可以为函数，或一个在methods段中定义的方法名
    attached() {
      let language = wx.getStorageSync('langIndex');
      this.setData({
        'language': language.en,
        now: (String(Date.parse(new Date())).substring(0, 10))*1,
      })
    },
    moved() {},
    detached() {},
  },

  // 生命周期函数，可以为函数，或一个在methods段中定义的方法名
  attached() {

  }, // 此处attached的声明会被lifetimes字段中的声明覆盖
  ready() {},

  pageLifetimes: {
    // 组件所在页面的生命周期函数
    show() {},
    hide() {},
    resize() {},
  },

  methods: {
    onTimeChange(e) {
      this.setData({
        timeData: e.detail,
      });
    },
    onChange(e) {
      let {
        index
      } = e.currentTarget.dataset;
      this.data.list[index].timeData = e.detail;
      this.setData({
        ['list[' + index + '].timeData']: e.detail,
      });
    },
    submit(e) {
      let goods_id = e.currentTarget.dataset.id;
      wx.navigateTo({
        url: "/mircoApp/local_life/goods/goods?goods_id=" + goods_id,
      })
    },
    taplink(e) {
      let item = e.currentTarget.dataset.item;
      this.triggerEvent('open_dialog', item)
    },
  },
});